Sample Code - Stop Event

This sample code shows the use of the Stop Event (Report Object). Modify the following sample code to fit your needs.

Dim rptView As CRPEAuto.View
Dim test As Integer

Private Sub Stop_Click()
'Starts up report for report event Stop
On Error GoTo ErrorHandler
Set repEvs = crsApp.OpenReport("c:\crw\reports\xtreme\www.sales.rpt")
test = MsgBox("Event default: Enabled = " & _
    repEvs.EventInfo.StartStopEventEnabled & Chr(13) & _
    Chr(13) & "Disable event?", vbYesNo)
If test = vbYes Then
repEvs.EventInfo.StartStopEventEnabled = False
MsgBox "Check event does not occur when report stops"
Else
repEvs.EventInfo.StartStopEventEnabled = True
MsgBox "Check event occurs when report stops"
End If
Set rptView = repEvs.Preview
rptView.Close
Exit Sub ' Exit to avoid handler.

ErrorHandler:
If crsApp.LastErrorCode <> 0 Then
MsgBox "Unexpected application error: " & _
        crsApp.LastErrorCode & "->" & crsApp.LastErrorString
End If
If repEvs.LastErrorCode <> 0 Then
MsgBox "Unexpected application error: " & _
        repEvs.LastErrorCode & "->" & repEvs.LastErrorString
End If
If Err.Number <> 0 Then
MsgBox "Unexpected VB error: " & Err.Number & "->" & Err.Description
End If
Call ResetErr
repEvs.ClearError
Resume Next
End Sub

Private Sub repEvs_Stop(ByVal Destination As CRPEAuto.CRPrintingDestination, _
                ByVal Status As CRPEAuto.CRPrintingProgress)
MsgBox "Report Stop event" & Chr(13) & Chr(13) & _
    "Parameters:" & Chr(13) & "Destination(window=1): " & _
    Destination & Chr(13) & "Status(complete=3): " & Status
End Sub


Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com